<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取元素位置</title>
    <style>
        .big{
            width: 800px;
            height: 600px;
            border: 3px solid black;
            margin: 0 auto;
            position: relative;
        }
        .one{
            width: 100px;
            height: 100px;
            border: 3px solid red;
            position: absolute;
            left: 10px;
            top:20px
        }
    </style>
</head>
<body>
    <div id="big" class="big">
        <div id="one" class="one"></div>
    </div>
    <script>
        const one = document.getElementById("one")
        console.log("offsetHeight",one.offsetHeight)
        console.log("offsetWidth",one.offsetWidth)
        console.log("offsetLeft",one.offsetLeft)
        console.log("offsetTop",one.offsetTop)
        console.log("offsetParent",one.offsetParent)
    </script>
</body>
</html>